<template>
  <el-input
    v-bind="$attrs"
    @input="onInput"
    @change="onChange"
    clearable
  ></el-input>
</template>

<script>
export default {
  methods: {
    onInput(e) {
      this.model = e.replace(/[^0-9\\.]/g, "");
      this.$emit("input", this.model);
    },
    onChange(e) {
      e = Number(e);
      e = e > 100 ? 100 : e;
      this.model = e.toFixed(2);
      this.$emit("input", this.model);
      this.$emit("change", this.model);
    },
  },
};
</script>

<style></style>
